# Set the following line to point to the CovidIdeologyReplication directory
# PROJECT_DIR="/path_to_directory/CovidIdeologyReplication/"

cd "$PROJECT_DIR"
mkdir generated_tex generated_images generated_data

cd "$PROJECT_DIR/scripts"

time Rscript 01_prep.R # 2 mins, approx
time Rscript 02_analysis.R # 2.5 mins, approx
time Rscript 03_outputs_w21_added.R # 15 seconds
time Rscript 04_outputs.R # 2 mins, approx
time Rscript 05_survey_experiment.R # 10 seconds
time Rscript 06_bsas_20_analysis.R # 1 second

# Compile latex

# Define the path to your LaTeX file

# Set the following line to point to the CurrentDraft directory
#LATEX_DIR="/path_to_directory/CurrentDraft/"

cd "$LATEX_DIR"

# Run latexmk with pdflatex
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make "CovidIdeology.tex"
latexmk -pdf -pdflatex="pdflatex -interaction=nonstopmode" -use-make "CovidIdeology_suppl.tex"

